<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
	<head>
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<meta http-equiv="Content-Type" content="text/html charset=utf-8"/>  	
		<title>{$GLOBALS.settings.site_title}: [[$TITLE]]</title>
		<link rel="StyleSheet" type="text/css" href="{$GLOBALS.site_url}/templates/_system/main/images/css/form.css" />
		<link rel="StyleSheet" type="text/css" href="{image src="design.css"}" />
		<link rel="StyleSheet" type="text/css" href="{$GLOBALS.site_url}/templates/_system/main/images/css/formbuilder.css" />
		{if $GLOBALS.current_language_data.rightToLeft}
			<link rel="StyleSheet" type="text/css" href="{image src="designRight.css"}" />
		{/if}
		<link rel="StyleSheet" type="text/css" href="{$GLOBALS.site_url}/system/ext/jquery/css/jquery-ui.css"  />
		<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery.js"></script>
		<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery-ui.js"></script>
		<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery.bgiframe.js"></script>
		<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery.form.js"></script>
		<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery.highlight.js"></script>
		<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery.validate.min.js"></script>
		<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery.autocomplete.pack.js"></script>
		<script language="javascript" type="text/javascript">
			$.ui.dialog.prototype.options.bgiframe = true;
			function popUpWindow(data, widthWin, heightWin, title) {ldelim}
				reloadPage = false;
				$("#messageBox").dialog('destroy').html('{capture name="displayJobProgressBar"}<img style="vertical-align: middle;" src="{$GLOBALS.site_url}/system/ext/jquery/progbar.gif" alt="[[Please, wait ...]]" /> [[Please, wait ...]]{/capture}{$smarty.capture.displayJobProgressBar|escape:'quotes'}'{literal});
				$("#messageBox").dialog({
					width: widthWin,
					height: heightWin,
					modal: true,
					title: title
				}).dialog( 'open' );
				$("#messageBox").html($("#"+data).html());
				return false;
			}
			function builderFieldBlockView(fieldID) {
				var elemVal = $("textarea[name='"+fieldID+"']").val();
				var pattern = /{([\w\d]+)}/g;
				var viewElem = $("#view_" + fieldID);
				elemVal = elemVal.replace(pattern, "&lt;$1 value&gt;");
				viewElem.html(elemVal);
				$("#edit_" + fieldID).hide("slow");
				viewElem.show("slow");
			}
			function builderFieldBlockEdit(fieldID) {
				$("#view_" + fieldID).hide("slow");
				$("#edit_" + fieldID).show("slow");
			}
			function builderFieldBlockSwitcher(fieldID) {
				var button = $("#button_" + fieldID);
				if (button.text() == 'Edit') {
					builderFieldBlockEdit(fieldID);
					button.text('View');
				}
				else if (button.text() == 'View') {
					builderFieldBlockView(fieldID);
					button.text('Edit');
				}
			}
			$("document").ready(function() {
				$("[id^='button_']").live("click", function() {
					var fieldID = $(this).parents(".htmlBlock").attr("id");
					builderFieldBlockSwitcher(fieldID);
				});
				$(".htmlBlock_info").live("click", function() {
					popUpWindow('listingFieldsKeys', 500, 300, 'You can use the following variables:'); return false;
				});
				$(".complexBlock_info").live("click", function() {
					popUpWindow($(this).attr('id') + "_details", 500, 300, 'You can use the following variables:'); return false;
				});
			});
		</script>
		{/literal}
	</head>
	<body>
		<div id="messageBox"></div>
		<div id="statusBox"></div>
		<div class="indexDiv">
			{$ERRORS_CONTENT}
			{$MAIN_CONTENT}
		</div>
	</body>
</html>
